import $ from 'jquery';
import code from './code.json';
import url from './url.json'

let loadTypes = function(){
    return new Promise(function(reslove,reject){
        $.ajax({
            url:url.types,
            type:"post",
            dataType:"json",
            success:reslove,
            error:reject
        })
    })
}

let loadFilmList = function(data={}){
    return new Promise(function(success,error){
        $.ajax({
            url:"http://127.0.0.1/filmApi/loadFilms.php",
            type:"post",
            data,
            dataType:"json",
            success,
            error
        })
    })
}

export default {
    loadTypes,
    loadFilmList,
    code
}